﻿using System;

namespace Reece.Open.Mvc.Atom.Models
{
    public struct AtomId
    {
        private Guid _id;

        public byte[] ToByteArray()
        {
            return _id.ToByteArray();
        }

        public override bool Equals(object obj)
        {
            return _id.Equals(obj);
        }

        public override int GetHashCode()
        {
            return _id.GetHashCode();
        }

        public static implicit operator AtomId(Guid id)
        {
            return new AtomId {_id = id};
        }

        public override string ToString()
        {
            return string.Format("urn:uuid:{0}", _id);
        }

        public Guid AsGuid()
        {
            return _id;
        }
    }
}